<template>
  <div>
    <MyHeader :background="'blue'" title="TabBar案例"></MyHeader>
    <div class="main">
      <router-view></router-view>
    </div>
    <MyTabBar @changeComponent="change" :list="tabList"></MyTabBar>
  </div>
</template>

<script>
import MyHeader from "./components/MyHeader";
import MyTabBar from "./components/MyTabBar.vue";

import axios from "axios";
export default {
  components: {
    MyTabBar,
    MyHeader,
  },
  data() {
    return {
      tabList: [],
    };
  },
  created() {
    axios.get("/list.json").then((res) => (this.tabList = res.data));
  },
  methods: {
    change(name) {
      this.$router.push({
        name,
      });
    },
  },
};
</script>

<style scoped>
.main {
  padding-top: 45px;
  padding-bottom: 51px;
}
</style>
